﻿<%@ Page Language="C#" MasterPageFile="~/MasterPageMain.master" AutoEventWireup="true" CodeFile="ManageUser.aspx.cs" Inherits="admin_ManageUser" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ctrlMainContent" Runat="Server">
    <tek:RadAjaxManagerProxy ID="uxAjaxManager" runat="server">
        <AjaxSettings>
            <tek:AjaxSetting AjaxControlID="grdUserList">
                <UpdatedControls>
                    <tek:AjaxUpdatedControl ControlID="grdUserList" />
                </UpdatedControls>
            </tek:AjaxSetting>
            <tek:AjaxSetting AjaxControlID="btnRebindUserList">
                <UpdatedControls>
                    <tek:AjaxUpdatedControl ControlID="grdUserList" />
                </UpdatedControls>
            </tek:AjaxSetting>
        </AjaxSettings>
    </tek:RadAjaxManagerProxy>
    
    <tln:TLNGrid ID="grdUserList" runat="server" GridLines="None"
        Width="100%" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="false"
        OnNeedDataSource="grdUserList_NeedDataSource" OnItemDataBound="grdUserList_ItemDataBound">
        <MasterTableView>
            <Columns>
                <tln:TLNGridBoundColumn HeaderText="User Name" DataField="LoginName" UniqueName="LoginName"
                    SortExpression="LoginName" />
                <tln:TLNGridBoundColumn HeaderText="First Name" DataField="UserNameFirst" UniqueName="UserNameFirst"
                    SortExpression="UserNameFirst" />
                <tln:TLNGridBoundColumn HeaderText="Last Name" DataField="UserNameLast" UniqueName="UserNameLast" SortExpression="UserNameLast"/>
                <tln:TLNGridBoundColumn HeaderText="Email" DataField="Email" UniqueName="Email" SortExpression="Email"/>
                <tln:TLNGridTemplateColumn HeaderText="Reset User" UniqueName="ResetPassword">
                    <ItemTemplate>
                        <asp:LinkButton ID="lnkResetUser" runat="server" Text="Kích Hoạt Lại" OnCommand="ResetPassword"
                            CommandArgument='<%#Eval("LoginName") %>' />
                    </ItemTemplate>
                </tln:TLNGridTemplateColumn>
                <tln:TLNGridTemplateColumn HeaderText="Delete" UniqueName="Delete">
                    <ItemTemplate>
                        <asp:LinkButton ID="lnkDelete" runat="server" Text="Xóa User" OnClientClick="return confirm('Bạn muốn xóa user này?')"
                            OnCommand="DeleteUser" CommandArgument='<%#Eval("LoginName") %>' />
                    </ItemTemplate>
                </tln:TLNGridTemplateColumn>
            </Columns>
        </MasterTableView>
    </tln:TLNGrid>
    <div style="padding-top:5px">
        <asp:Button OnClientClick="OpenModalWindow(1, 'UpdateUser.aspx', 500, 290);return false;" ID="ctrlCreateUser" runat="server"  />
    </div>
    
    <div style="display:none">
        <asp:Button ID="btnRebindUserList" runat="server"  OnClick="RebindUserList" style="display:none" />
    </div>
    
    <tek:RadCodeBlock runat="server">

        <script type="text/javascript">
            function RebindUserList() {
                document.getElementById("<%=btnRebindUserList.ClientID %>").click();
            }
        </script>

    </tek:RadCodeBlock>
</asp:Content>

